<?php
  session_start();
?>
<html>
<head>
<meta http-equiv="Content-Type" content="html/text; charset=utf-8" />
<title>简易BBS系统</title>
</head>
<body>
<?php
include "head.php";
include "mysql.php";
include "myfunction.php";
$aa=new mysql;
$aa->link("");
$bb=new myfunction;
include "total_info.php";
?>
<table width="98%" border="0" align="center" cellspacing="0"  cellpadding="0">
<tr>
 <td width="60%" height="15" ><a href="indexs.php">简易BBS系统</a>>>发新帖子</td>
 <td width="40%" align="right">发新帖子</td>
</tr>
</table>
<table width="98%" border="0" align="center" cellspacing="0"  cellpadding="0">
<tr>
 <td height="15" bgcolor="#000000" align="center"><font color="#FFFFFF">发布新帖</font>
 </td>
</tr>
</table>
<?php
if($_SESSION["user_name"]==""){
	echo "<script lauguage=javascript>alert('您尚未登录，请登录');</script>";
   } else{
	$tijiao=$_POST["new_note"];
	if($tijiao=="提交"){
		$module_id=$_POST["module_id"];
		$title=$_POST["title"];
		$content=$_POST["content"];
		$bb->str_to($content);
		$today=date("Y-m-d H-i-s");
		if($module_id=="" and $title=="" and $content==""){
			echo "必须选择子模块，标题和内容不能为空";
		}else{
			$query="insert into note_info (module_id,title,content,time,user_name) values ('$module_id','$title','$content','$today','$_SESSION[user_name]')";

			if($aa->excu($query)){
                            echo "<script language=javascript>alert('发布新帖成功');location.href='son_module_list.php?module_id=" .$module_id . "';</script>";
                        }
                       
			
		}
	}
}
 ?>

  <form action="?module_id=<?php echo $_GET['module_id'] ?>" method="post">
  <table width="80%" align="center" cellspacing="1" cellpadding="0" border="1">
   <tr>
    <td height="15" width="30%" align="right">隶属模块</td>
    <td align="left" width="70%"><?php echo $bb->son_module_list($son_module_id); ?> </td>
   </tr>
   <tr>
    <td height="15" width="30%" align="right">标题</td>
    <td align="left" width="70%"><input type="text" name="title">  </td>
   </tr>
   <tr>
    <td height="60" width="30%" align="right">内容</td>
    <td align="left" width="70%"><textarea cols="50" rows="8" name="content"></textarea> </td>
   </tr>
   <tr>
    <td height="15" width="30%" align="right">发帖人</td>
    <td align="left" width="70%"><input type="text" name="author" value="<?php echo $_SESSION["user_name"]; ?>" /> </td>
   </tr>
   <tr>
    <td height="15" width="30%" align="right">时间</td>
    <td align="left" width="70%">系统将自动记录 </td>
   </tr>
   <tr>
    <td height="15" colspan="2" align="center">
     <input type="submit" name="new_note" value="提交"/>&nbsp;&nbsp;
     <input type="reset" value="重置"/>
    </td>
   </tr>
   </table>
   </form>
   <?php
    include "foot.php";
    ?>
   </body>
   </html>

















